Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: free resources less often; fix: handle non-standard inpainting payloads #199

Merged
merged 5 commits into from
Feb 23, 2024

Conversation

tazlin
Copy link
Member

@tazlin tazlin commented Feb 23, 2024

This PR has two major components:

Removing calls to garbage collect ram/vram

This is an experiment to try and give a better chance at having loaded models remain in VRAM/RAM. The cleanup() and garbage_collect() functions date back to a time when hordelib was doing much more in reaching into ComfyUI and changing behavior surrounding memory allocation. This change may allow ComfyUI internally to handle better when it feels memory should or should not be free.

As for the worker use-case, the worker code already manually calls equivalents of these functions at the appropriate times, and as such these calls should be entirely redundant for non-worker use-cases, and may serve to conflict somewhat with worker use-cases.

Fixes to inpainting model handling

Certain payloads for inpainting models (especially ones that lack a source_image and/or source_mask) cause ComfyUI to throw an exception. In the case of the worker, this causes the entire job to fault and potentially leads to workers getting placed into maintenance mode. This PR introduces the behavior of defaulting source_image/source_mask if they are not present.

There are warning/error level logging messages to this effect, so in the off chance hordelib is being used standalone, those users will be clued into this potentially surprising behavior. Horde users will receive GEN_METADATA objects as appropriate.

@db0
Copy link
Member

db0 commented Feb 23, 2024

Makes sense

@tazlin tazlin changed the title feat: free resources less often feat: free resources less often; fix: handle non-standard inpainting payloads Feb 23, 2024
@tazlin tazlin merged commit 7a690db into main Feb 23, 2024
2 checks passed
@tazlin tazlin deleted the cleanup-less branch February 23, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants